﻿@using ReportViewerForMvc;
@using Apps.Web.Core;
@using Apps.Locale;
@using System.Data;
@model DataTable
@{
    ViewBag.Title = "自采煤台账";
    Layout = "~/Views/Shared/_Index_Layout.cshtml";
}
@{
    if (Model == null)
    {
        <div style="margin:0 auto; width:100%; font-size:36px; text-align:center;">没有查询到数据</div>
        return;
    }
    if (Model.Rows.Count <= 0)
    {
        <div style="margin:0 auto; width:100%; font-size:36px; text-align:center;">没有查询到数据</div>
        return;
    }
}
<div class="divContent" id="ppppp" style="margin: 10px; width: 100%; text-align: center;">
    @for (int i = 0; i < Model.Rows.Count; i++)
    {
        if (i >= 18 && i % 18 == 0)
        {
            <div style=" display:flex; flex-flow:row; justify-content:space-between; margin:20px; font-size:16px;">
                <div>打印日期：@DateTime.Now.ToString("yyyy-MM-dd")</div>
                <div>
                    <span style="margin-right:150px;">
                        审批：
                    </span>
                    <span style="margin-right:150px;">
                        制表：
                    </span>
                </div>
            </div>
            <div style="page-break-after:always"></div>
        }
        <div>
            @if (i == 0 || i % 18 == 0)
            {
                <div style="margin:0 auto; width:100%; font-size:36px; text-align:center;">@(string.IsNullOrEmpty(ViewBag.TYPE_ID) ? "其他" : ViewBag.TYPE_ID)台账</div>
                <div style=" display: flex; flex-flow: row; justify-content: space-between; margin: 20px; font-size: 16px;">
                    <div>制表单位：开滦中润公司</div>
                    <div>日期：@(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))</div>
                </div>

                <table style="border: 1px solid black;text-align:center;">
                    <thead>
                        <tr>
                            <th style="border: 1px solid black;text-align:center; padding:3px; font-weight:bold; width:80px;">
                                日期
                            </th>
                            <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 60px;">
                                编号
                            </th>
                            <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 80px;">
                                类型
                            </th>
                            @if ("煤场煤,自检煤,小焦炉煤,小焦炉焦炭,自检焦炭,配合煤".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                    MT
                                </th>
                            } @if ("煤场煤,自检煤,小焦炉煤,小焦炉焦炭,自检焦炭,配合煤".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                    AD
                                </th>
                            }
                            @if ("煤场煤,自检煤,小焦炉煤,小焦炉焦炭,自检焦炭,配合煤".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                    Vdaf
                                </th>
                            }
                            @if ("煤场煤,自检煤,小焦炉煤,小焦炉焦炭,自检焦炭,配合煤".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                    Std
                                </th>
                            }
                            @if ("煤场煤,自检煤,小焦炉煤,小焦炉焦炭,自检焦炭,配合煤".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                    Mad
                                </th>
                            } @if ("煤场煤,自检煤".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                    热值
                                </th>
                            }
                            @if ("煤场煤,配合煤".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                    G
                                </th>
                            }
                            @if ("煤场煤,自检煤,配合煤".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                    Y
                                </th>
                            }
                            @if ("煤场煤,配合煤".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                    X
                                </th>
                            }
                            @if ("煤场煤,自检煤,配合煤".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                    a
                                </th>
                            }
                            @if ("煤场煤,配合煤".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                    b
                                </th>
                            }
                            @if ("配合煤".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                    @("<3")
                                </th>
                            }
                            @if ("配合煤".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                    3~10
                                </th>
                            }
                            @if ("配合煤".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                    >10
                                </th>
                            }
                            @if ("小焦炉煤,小焦炉焦炭,自检焦炭".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                    CRI
                                </th>
                            }
                            @if ("小焦炉煤,小焦炉焦炭,自检焦炭".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                    CSR
                                </th>
                            }
                            @if ("自检焦炭".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                    M40
                                </th>
                            }
                            @if ("自检焦炭".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                    M10
                                </th>
                            }
                            @if ("自检焦炭".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black; text-align: center; padding: 3px; font-weight: bold; width: 65px; ">
                                    >80mm
                                </th>
                            }
                            @if ("自检焦炭".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black; text-align: center; padding: 3px; font-weight: bold; width: 65px; ">
                                    80~60mm
                                </th>
                            }
                            @if ("自检焦炭".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black; text-align: center; padding: 3px; font-weight: bold; width: 65px; ">
                                    60~40mm
                                </th>
                            }
                            @if ("自检焦炭".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black; text-align: center; padding: 3px; font-weight: bold; width: 65px; ">
                                    40~25mm
                                </th>
                            }
                            @if ("自检焦炭".Contains(ViewBag.TYPE_ID))
                            {
                                <th style="border: 1px solid black; text-align: center; padding: 3px; font-weight: bold; width: 65px; ">
                                    @("<25mm")
                                </th>
                            }
                        </tr>
                    </thead>
                </table>
            }
            <table style="border: 1px solid black;text-align:center;">

                <tbody>
                    <tr>
                        <td style="border: 1px solid black;text-align:center; padding:3px; width:80px;">
                            @if (Model.Rows[i]["UPDATE_TIME"] != null)
                            {
                                DateTime temp = DateTime.Now;
                                DateTime.TryParse(Model.Rows[i]["UPDATE_TIME"].ToString(), out temp);
                                @(temp.ToString("yyyy-MM-dd"))
                            }
                        </td>
                        <td style="border: 1px solid black;text-align:center; padding:3px; width:60px;">
                            @(Model.Rows[i]["BATCH_CODE"].ToString())
                        </td>
                        <td style="border: 1px solid black;text-align:center; padding:3px; width:80px;">
                            @(Model.Rows[i]["TYPE_STR"].ToString())
                        </td>
                        @if ("煤场煤,自检煤,小焦炉煤,小焦炉焦炭,自检焦炭,配合煤".Contains(ViewBag.TYPE_ID))
                        {
                            <td style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                @(Model.Rows[i]["MT"].ToString())
                            </td>
                        } @if ("煤场煤,自检煤,小焦炉煤,小焦炉焦炭,自检焦炭,配合煤".Contains(ViewBag.TYPE_ID))
                        {
                            <td style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                @(Model.Rows[i]["AD"].ToString())
                            </td>
                        }
                        @if ("煤场煤,自检煤,小焦炉煤,小焦炉焦炭,自检焦炭,配合煤".Contains(ViewBag.TYPE_ID))
                        {
                            <td style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                @(Model.Rows[i]["VDAF"].ToString())
                            </td>
                        }
                        @if ("煤场煤,自检煤,小焦炉煤,小焦炉焦炭,自检焦炭,配合煤".Contains(ViewBag.TYPE_ID))
                        {
                            <td style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                @(Model.Rows[i]["STD"].ToString())
                            </td>
                        }
                        @if ("煤场煤,自检煤,小焦炉煤,小焦炉焦炭,自检焦炭,配合煤".Contains(ViewBag.TYPE_ID))
                        {
                            <td style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                @(Model.Rows[i]["MAD"].ToString())
                            </td>
                        } @if ("煤场煤,自检煤".Contains(ViewBag.TYPE_ID))
                        {
                            <td style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                @(Model.Rows[i]["QNETAR_KCAL"].ToString())
                            </td>
                        }
                        @if ("煤场煤,配合煤".Contains(ViewBag.TYPE_ID))
                        {
                            <td style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                @(Model.Rows[i]["G"].ToString())
                            </td>
                        }
                        @if ("煤场煤,自检煤,配合煤".Contains(ViewBag.TYPE_ID))
                        {
                            <td style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                @(Model.Rows[i]["Y"].ToString())
                            </td>
                        }
                        @if ("煤场煤,配合煤".Contains(ViewBag.TYPE_ID))
                        {
                            <td style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                @(Model.Rows[i]["X"].ToString())
                            </td>
                        }
                        @if ("煤场煤,自检煤,配合煤".Contains(ViewBag.TYPE_ID))
                        {
                            <td style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                @(Model.Rows[i]["A"].ToString())
                            </td>
                        }
                        @if ("煤场煤,配合煤".Contains(ViewBag.TYPE_ID))
                        {
                            <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                @(Model.Rows[i]["B"].ToString())
                            </th>
                        }
                        @if ("配合煤".Contains(ViewBag.TYPE_ID))
                        {
                            <td style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                @(Model.Rows[i]["SMALL"].ToString())
                            </td>
                        }
                        @if ("配合煤".Contains(ViewBag.TYPE_ID))
                        {
                            <td style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                @(Model.Rows[i]["MEDIUM"].ToString())
                            </td>
                        }
                        @if ("配合煤".Contains(ViewBag.TYPE_ID))
                        {
                            <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                @(Model.Rows[i]["LARGE"].ToString())
                            </th>
                        }
                        @if ("小焦炉煤,小焦炉焦炭,自检焦炭".Contains(ViewBag.TYPE_ID))
                        {
                            <td style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                @(Model.Rows[i]["CRI"].ToString())
                            </td>
                        }
                        @if ("小焦炉煤,小焦炉焦炭,自检焦炭".Contains(ViewBag.TYPE_ID))
                        {
                            <td style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                @(Model.Rows[i]["CSR"].ToString())
                            </td>
                        }
                        @if ("自检焦炭".Contains(ViewBag.TYPE_ID))
                        {
                            <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                @(Model.Rows[i]["M40"].ToString())
                            </th>
                        }
                        @if ("自检焦炭".Contains(ViewBag.TYPE_ID))
                        {
                            <td style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 35px;">
                                @(Model.Rows[i]["M10"].ToString())
                            </td>
                        }
                        @if ("自检焦炭".Contains(ViewBag.TYPE_ID))
                        {
                            <td style="border: 1px solid black; text-align: center; padding: 3px; font-weight: bold; width: 65px; ">
                                @(Model.Rows[i]["JTXXLARGE"].ToString())
                            </td>
                        }
                        @if ("自检焦炭".Contains(ViewBag.TYPE_ID))
                        {
                            <td style="border: 1px solid black; text-align: center; padding: 3px; font-weight: bold; width: 65px; ">
                                @(Model.Rows[i]["JTXLARGE"].ToString())
                            </td>
                        }
                        @if ("自检焦炭".Contains(ViewBag.TYPE_ID))
                        {
                            <td style="border: 1px solid black; text-align: center; padding: 3px; font-weight: bold; width: 65px; ">
                                @(Model.Rows[i]["JTLARGE"].ToString())
                            </td>
                        }
                        @if ("自检焦炭".Contains(ViewBag.TYPE_ID))
                        {
                            <td style="border: 1px solid black; text-align: center; padding: 3px; font-weight: bold; width: 65px; ">
                                @(Model.Rows[i]["JTMEDIUM"].ToString())
                            </td>
                        }
                        @if ("自检焦炭".Contains(ViewBag.TYPE_ID))
                        {
                            <td style="border: 1px solid black; text-align: center; padding: 3px; font-weight: bold; width: 65px; ">
                                @(Model.Rows[i]["JTSMALL"].ToString())
                            </td>
                        }
                    </tr>

                </tbody>
            </table>
            @if (i >= 18 && i % 18 == 0)
            {

            }


        </div>

    }

    @*<div>
            <div style="margin:0 auto; width:100%; font-size:36px; text-align:center;">@(string.IsNullOrEmpty(ViewBag.TYPE_ID)? "自采煤" : ViewBag.TYPE_ID)台账</div>
            <div style=" display:flex; flex-flow:row; justify-content:space-between; margin:20px; font-size:24px;">
                <div>制表单位：开滦中润公司</div>
                <div>日期：@(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))</div>
            </div>
            <table style="border: 1px solid black;text-align:center;">
                <thead>
                    <tr>
                        <th style="border: 1px solid black;text-align:center; padding:3px; font-weight:bold; width:80px;">
                            日期
                        </th>
                        <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 60px;">
                            编号
                        </th>
                        <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 80px;">
                            类型
                        </th>
                        <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 30px;">
                            MT
                        </th>
                        <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 30px;">
                            AD
                        </th>
                        <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 30px;">
                            Vdaf
                        </th>
                        <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 30px;">
                            Std
                        </th>
                        <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 30px;">
                            Mad
                        </th>
                        <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 30px;">
                            热值
                        </th>
                        <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 30px;">
                            G
                        </th>
                        <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 30px;">
                            Y
                        </th>
                        <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 30px;">
                            X
                        </th>
                        <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 30px;">
                            a
                        </th>
                        <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 30px;">
                            b
                        </th>
                        <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 30px;">
                            @("<3")
                        </th>
                        <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 30px;">
                            3~10
                        </th>
                        <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 30px;">
                            >10
                        </th>
                        <th style="border: 1px solid black;text-align:center; padding:3px; font-weight: bold; width: 30px;">
                            TOD
                        </th>
                    </tr>
                </thead>
                <tbody>
                    @for (int i = 0; i < 20; i++)
                    {
                        <tr>
                            <td style="border: 1px solid black;text-align:center; padding:3px;">
                                @if (Model.Rows[i]["UPDATE_TIME"] != null)
                                {
                                    DateTime temp = DateTime.Now;
                                    DateTime.TryParse(Model.Rows[i]["UPDATE_TIME"].ToString(), out temp);
                                    @(temp.ToString("yyyy-MM-dd"))
                                }
                            </td>
                            <td style="border: 1px solid black;text-align:center; padding:3px;">
                                @(Model.Rows[i]["BATCH_CODE"].ToString())
                            </td>
                            <td style="border: 1px solid black;text-align:center; padding:3px;">
                                @(Model.Rows[i]["TYPE_STR"].ToString())
                            </td>
                            <td style="border: 1px solid black;text-align:center; padding:3px;">
                                @(Model.Rows[i]["MT"].ToString())
                            </td>
                            <td style="border: 1px solid black;text-align:center; padding:3px;">
                                @(Model.Rows[i]["AD"].ToString())
                            </td>
                            <td style="border: 1px solid black;text-align:center; padding:3px;">
                                @(Model.Rows[i]["VDAF"].ToString())
                            </td>
                            <td style="border: 1px solid black;text-align:center; padding:3px;">
                                @(Model.Rows[i]["STD"].ToString())
                            </td>
                            <td style="border: 1px solid black;text-align:center; padding:3px;">
                                @(Model.Rows[i]["MAD"].ToString())
                            </td>
                            <td style="border: 1px solid black;text-align:center; padding:3px;">
                            </td>
                            <td style="border: 1px solid black;text-align:center; padding:3px;">
                                @(Model.Rows[i]["G"].ToString())
                            </td>
                            <td style="border: 1px solid black;text-align:center; padding:3px;">
                                @(Model.Rows[i]["Y"].ToString())
                            </td>
                            <td style="border: 1px solid black;text-align:center; padding:3px;">
                                @(Model.Rows[i]["X"].ToString())
                            </td>
                            <td style="border: 1px solid black;text-align:center; padding:3px;">
                                @(Model.Rows[i]["A"].ToString())
                            </td>
                            <td style="border: 1px solid black;text-align:center; padding:3px;">
                                @(Model.Rows[i]["B"].ToString())
                            </td>
                            <td style="border: 1px solid black;text-align:center; padding:3px;">
                                @(Model.Rows[i]["SMALL"].ToString())
                            </td>
                            <td style="border: 1px solid black;text-align:center; padding:3px;">
                                @(Model.Rows[i]["MEDIUM"].ToString())
                            </td>
                            <td style="border: 1px solid black;text-align:center; padding:3px;">
                                @(Model.Rows[i]["LARGE"].ToString())
                            </td>

                        </tr>
                    }
                </tbody>
            </table>
        </div>*@


</div>


<script type="text/javascript">

    function printpage() {
        pagesetup_null();
        let newstr = document.getElementById("ppppp").innerHTML;
        let oldstr = document.body.innerHTML;

        document.body.innerHTML = newstr;
        window.print();
        document.body.innerHTML = oldstr;
        setTimeout("window.close();", 1000);
    }

    function CloseAfterPrint() {
        if (tata = document.execCommand("print")) {
            window.close();
            bindCommbox();
        }
        else setTimeout("CloseAfterPrint();", 1000);
    }


    function pagesetup_null() {
        var hkey_root, hkey_path, hkey_key;
        hkey_root = "HKEY_CURRENT_USER"
        hkey_path = "\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
        try {
            var RegWsh = new ActiveXObject("WScript.Shell");
            hkey_key = "header";
            RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "");
            hkey_key = "footer";
            RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "");
        } catch (e) { }

    }
                            //printpage();
</script>

<style media="print">
   @("@")
    page {
        size: auto; /* auto is the initial value */
        margin: 0mm; /* this affects the margin in the printer settings */
        size: portrait;
    }

    .divContent {
        margin: 5px;
        width: 100%;
        text-align: center;
        background-color:yellow;
        /* transform: scale(0.9);
        -webkit-transform: scale(0.8);*/
    }

    table, th, td {
        border: 1px solid black;text-align:center;
    }

    .font10 {
        font-size: 12px;
        transform: scale(0.8);
    }

    .headImg {
        width: 78px;
        height: 97px;
    }
</style>
